package com.jc.repository.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;


@Component
@PropertySource(value = {"classpath:datasource.properties"})
public class DataSourceProperties {

//	@Value("${jdbc.driver-class}")
	private String driverClass = "com.mysql.jdbc.Driver";

//	@Value("${jdbc.url}")
	private String url = "jdbc:mysql://127.0.0.1:3306/mydb?useUnicode=false&autoReconnect=true&characterEncoding=utf-8";

//	@Value("${jdbc.username}")
	private String username = "root";

//	@Value("${jdbc.password}")
	private String password = "root";

//	@Value("${jdbc.acquire-increment}")
	private int acquireIncrement = 5;

//	@Value("${jdbc.max-pool-size}")
	private int maxPoolSize = 30;

//	@Value("${jdbc.min-pool-size}")
	private int minPoolSize = 5;

//	@Value("${jdbc.preferred-test-query}")
	private String preferredTestQuery = "select user()";

	private int idleConnectionTestPeriod = 70;

//	@Value("${jdbc.max-idle-time}")
	private int maxIdleTime =60;

//	@Value("${jdbc.acquire-retry-attempts}")
	private int acquireRetryAttempts = 20;

//	@Value("${jdbc.initial-pool-size}")
	private int initialPoolSize = 5;

	public String getDriverClass() {
		return driverClass;
	}

	public void setDriverClass(String driverClass) {
		this.driverClass = driverClass;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public int getAcquireIncrement() {
		return acquireIncrement;
	}

	public void setAcquireIncrement(int acquireIncrement) {
		this.acquireIncrement = acquireIncrement;
	}

	public String getPreferredTestQuery() {
		return preferredTestQuery;
	}

	public void setPreferredTestQuery(String preferredTestQuery) {
		this.preferredTestQuery = preferredTestQuery;
	}

	public int getIdleConnectionTestPeriod() {
		return idleConnectionTestPeriod;
	}

	public void setIdleConnectionTestPeriod(int idleConnectionTestPeriod) {
		this.idleConnectionTestPeriod = idleConnectionTestPeriod;
	}

	public int getMaxIdleTime() {
		return maxIdleTime;
	}

	public void setMaxIdleTime(int maxIdleTime) {
		this.maxIdleTime = maxIdleTime;
	}

	public int getAcquireRetryAttempts() {
		return acquireRetryAttempts;
	}

	public void setAcquireRetryAttempts(int acquireRetryAttempts) {
		this.acquireRetryAttempts = acquireRetryAttempts;
	}

	public int getInitialPoolSize() {
		return initialPoolSize;
	}

	public void setInitialPoolSize(int initialPoolSize) {
		this.initialPoolSize = initialPoolSize;
	}

	public int getMaxPoolSize() {
		return maxPoolSize;
	}

	public void setMaxPoolSize(int maxPoolSize) {
		this.maxPoolSize = maxPoolSize;
	}

	public int getMinPoolSize() {
		return minPoolSize;
	}

	public void setMinPoolSize(int minPoolSize) {
		this.minPoolSize = minPoolSize;
	}
	
}
